import axios from 'axios';
let{VITE_MAP_KEY}=import.meta.env
//请求拦截
axios.interceptors.request.use(config => {
    let url = config.url;
    let reg=/^\/map/
    if(reg.test(url)&&url.includes('?')){
        config.url=`${url}&key=${VITE_MAP_KEY}`
    }else if(reg.test(url)){
        config.url=`${url}?key=${VITE_MAP_KEY}`
    }
    return config;
})
//响应拦截
axios.interceptors.response.use(res => {
    return res.data
})
export default axios;